package com.sy.module_clockin.db

import android.content.Context
import androidx.room.Database
import androidx.room.Room
import androidx.room.RoomDatabase
import androidx.room.TypeConverters
import com.sy.module_clockin.db.dbsheet.ClockInData


@Database(entities = [ClockInData::class], version = 1,exportSchema = false)
@TypeConverters(Converters::class)
abstract class ClockInDatabase : RoomDatabase() {

    abstract fun clockInDataDao(): ClockInDataDao

    companion object {
        private var instance: ClockInDatabase? = null

        fun getInstance(context: Context): ClockInDatabase {
            return instance ?: synchronized(this) {
                Room.databaseBuilder(context, ClockInDatabase::class.java,"${context.packageName}clockin")
                    .build().apply { instance = this }
            }
        }
    }
}